<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="./index.css" />
    <script src="../jquery-3.6.3-min.js"></script>

    <title>检测按钮是否被选中</title>
  </head>
  <body>
    <div id="div" class="div">
      <input type="checkbox" name="marry" id="marry" />婚否
    </div>
    <!-- <script>
      // 检测 input 元素中的 checked 属性是否被选中, attr()不是不会检测的
      var as = $("#marry").prop("checked");
      console.log(as);

      $("#div").addClass("red").css({
        color: "#fff",
      });
    </script> -->
    <script src="./index.js"></script>
  </body>
</html>
